<?
    $method = $this->router->method;
?>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?= base_url() ?>assets/js/libs/jquery-v1.10.2.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery-migrate-1.0.0.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery.dropdownized.min.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery.validate.min.js"></script>
<script src="<?= base_url() ?>assets/js/libs/hoverIntent.js"></script>
<script src="<?= base_url() ?>assets/js/libs/jquery.thumbhover.js"></script>

<script type="text/javascript">

    var log = console.log;

    var API = API || {};
    API = {
        Data: {
            base_url: '<?= base_url(); ?>',
            lang_url: '<?= lang_url(); ?>',
            method: '<?= $this->router->fetch_method(); ?>',
            cur_lang: '<?= $this->lang->mci_current(); ?>',
            HOST_URL_HOTELS: '<?= HOST_URL_HOTELS; ?>'
        },
    };



    // DO Langs here
    var lang = new Array();
    lang['top.custom_search'] = "<?= lang('top.custom_search'); ?>";
    lang['form.dest_region'] = "<?= lang('form.dest_region'); ?>";
    lang['form.person'] = "<?= lang('form.person'); ?>";
    lang['form.persons'] = "<?= lang('form.persons'); ?>";
    lang['form.show_all_items'] = "<?= lang('form.show_all_items'); ?>";

    lang['filter.filtering'] = "<?= lang('filter.filtering'); ?>";

    lang['dtl.adults'] = "<?= lang('dtl.adults'); ?>";
    lang['dtl.teenagers'] = "<?= lang('dtl.teenagers'); ?>";
    lang['dtl.children'] = "<?= lang('dtl.children'); ?>";
    lang['dtl.babies'] = "<?= lang('dtl.babies'); ?>";
    lang['days'] = "<?= lang('days'); ?>";
    lang['book_now'] = "<?= lang('res.book_now'); ?>";
    lang['calculating'] = "<?= lang('calculating'); ?>";

    lang['dtl.subscribing'] = "<?= lang('dtl.subscribing'); ?>";
    lang['dtl.subscribe_thanks'] = "<?= lang('dtl.subscribe_thanks'); ?>";
    lang['dtl.subscribe_alredy'] = "<?= lang('dtl.subscribe_alredy'); ?>";

    lang['dtl.posting_question'] = "<?= lang('dtl.posting_question'); ?>";
    lang['dtl.posting_thanks'] = "<?= lang('dtl.posting_thanks'); ?>";

    lang['available'] = "<?= lang('available'); ?>";
    lang['occupied'] = "<?= lang('occupied'); ?>";
    lang['selected'] = "<?= lang('selected'); ?>";
    lang['arrival'] = "<?= lang('arrival'); ?>";
    lang['departure'] = "<?= lang('departure') ?>";

</script>

<? if ($method === 'index' || $method === 'search' || $method === 'accommodation'): ?>

        <script src="<?= base_url() ?>assets/js/libs/jquery.colorbox-min.js"></script>

    <? endif; ?>

<? if ($method === 'index' || $method === 'search'): ?>

        <script src="<?= base_url() ?>assets/js/api/form.js"></script>
        <script src="<?= base_url() ?>assets/js/form.js"></script>

    <? endif; ?>

<? if ($method === 'index'): ?>

        <script src="<?= base_url() ?>assets/js/libs/responsiveslides.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.bxslider.min.js"></script>
        <script src="<?= base_url() ?>assets/js/index.js"></script>

    <? endif; ?>

<? if ($method === 'search' || $method === 'accommodation'): ?>

    <? endif; ?>

<? if ($method === 'search'): ?>

        <script src="<?= base_url() ?>assets/js/libs/underscore-min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.loadmask.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.multi-accordion-1.5.3.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.pajinate.min.js"></script>
        <script src="<?= base_url() ?>assets/js/libs/jquery.scrollTo-min.js"></script>
        <script src="<?= base_url() ?>assets/js/api/filter.js"></script>

    <? endif; ?>

<? if ($method === 'accommodation'): ?>

    <? endif; ?>

<script src="<?= base_url() ?>assets/js/plugins.js"></script>

<script type="text/javascript">

    // Add a script element as a child of the body
    function downloadJSAtOnload() {

        loadGMAPScript = function() {
            
            var element0 = document.createElement("script");
            element0.src = API.Data.base_url + "assets/js/libs/markerclusterer_packed.js";
            document.body.appendChild(element0);
            
            var element1 = document.createElement("script");
            element1.src = API.Data.base_url + "assets/js/api/google_map.js";
            document.body.appendChild(element1);

        }

        var element = document.createElement("script");
        element.type = "text/javascript";
        element.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyA8S8GdXphRexN5dRL-A5o4GDvBqMFx-iI&sensor=false&callback=loadGMAPScript";
        document.body.appendChild(element);

    }

    $(window).load(function() {
        downloadJSAtOnload();
    });


</script>

<script src="<?= base_url() ?>assets/js/main.js"></script>